{extend name="base" /}
{block name="body"}
<div class="layui-card">
    <div class="layui-card-header">编辑数据</div>
    <div class="layui-card-body">
        <form action="{:request()->url()}" class="layui-form" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">文章封面</label>
                <div class="layui-input-block">
                    <input type="text" name="image" value="{$data.image|default=''}" autocomplete="off" placeholder="请上传文章封面" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position ajax-images"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章封面</label>
                <div class="layui-input-block">
                    <input type="text" name="image" value="{$data.image|default=''}" autocomplete="off" placeholder="请上传文章封面" class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position ajax-video"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">* 所属分类</label>
                <div class="layui-input-block">
                    <select name="cid">
                        <option value="">请选择所属分类</option>
                        {foreach name="category" item="v"}
                        <option value="{$v.id}" {if condition="isset($data) and $data.cid eq $v.id"}selected="selected"{/if}>{neq name="v.level" value="1"}|{php}for($i=1;$i<$v['level'];$i++){echo ' ----';}{/php}{/neq} {$v.category_name}</option>
                        {/foreach}
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">多选--新增</label>
                <div class="layui-input-block">
                    <select name="mult[]" multiple="multiple" data-val="" class="mySelect">
                        <option value=""></option>
                        <option value="0">写作</option>
                        <option value="1">阅读</option>
                        <option value="2">游戏</option>
                        <option value="3">音乐</option>
                        <option value="4">旅行</option>
                    </select>

                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">时间--新增</label>
                <div class="layui-input-block">
                    <input type="text" name="pubtime" autocomplete="off" value="{$data.pubtime|default=''}" placeholder="" class="layui-input layuiDate">
                </div>
            </div>


            <div class="layui-form-item">
                <label class="layui-form-label">* 文章标题</label>
                <div class="layui-input-block">
                    <input type="text" name="title" value="{$data.title|default=''}" autocomplete="off" placeholder="请输入文章标题" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章作者</label>
                <div class="layui-input-block">
                    <input type="text" name="author" value="{$data.author|default=''}" autocomplete="off" placeholder="请输入文章作者" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章简介</label>
                <div class="layui-input-block">
                    <textarea name="summary" placeholder="请输入文章简介" class="layui-textarea">{$data.summary|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">文章相册</label>
                <div class="layui-input-inline" style="width:112px;">
                    <input type="hidden" name="photo">
                    <button type="button" class="layui-btn layui-btn-primary ajax-photos"><i class="fa fa-file-image-o"></i> 选择图片</button>
                </div>
                <div class="layui-form-mid layui-word-aux">允许多文件上传，不支持ie8/9</div>
            </div>
            {if condition="!empty($data['photo'])"}
            {foreach name="data.photo" item="v"}
            <div class="layui-form-item">
                <label class="layui-form-label"></label>
                <div class="layui-input-block">
                    <input type="text" name="photo[]" value="{$v}" autocomplete="off" readonly class="layui-input">
                    <button type="button" class="layui-btn layui-btn-primary layui-btn-position delete-photo"><i class="fa fa-times-circle"></i></button>
                </div>
            </div>
            {/foreach}
            {/if}

            <div class="layui-form-item">
                <label class="layui-form-label">详情内容</label>
                <div class="layui-input-block">
                    <textarea name="content" placeholder="请输入详情内容" id="editor" style="height:400px;">{$data.content|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">SEO关键字</label>
                <div class="layui-input-block">
                    <input type="text" name="keywords" autocomplete="off" value="{$data.keywords|default=''}" placeholder="请输入SEO关键字" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">SEO描述</label>
                <div class="layui-input-block">
                    <textarea name="description" autocomplete="off" placeholder="请输入SEO描述" class="layui-textarea">{$data.description|default=''}</textarea>
                </div>
            </div>
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="*" lay-submit="">保存</button>
                    <button class="layui-btn layui-btn-primary" type="reset">重置</button>
                </div>
            </div>
        </form>
    </div>
</div>
{/block}
{block name="js"}
<script src="__LIBS__/ueditor/ueditor.config.js"></script>
<script src="__LIBS__/ueditor/ueditor.all.min.js"></script>
<script src="__LIBS__/ueditor/lang/zh-cn/zh-cn.js"></script>
<script>
    UE.getEditor('editor',{
        // initialFrameWidth :800,// 设置编辑器宽度
        initialFrameHeight:400,// 设置编辑器高度
        scaleEnabled:true
    });
</script>
{/block}
